{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "hired-philosophy",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "raw",
   "id": "limiting-sperm",
   "metadata": {},
   "source": [
    "四个方法： dumps、dump、loads、load。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "outside-dollar",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"xiaojun\": \"123456\", \"xiaohei\": \"7891\", \"abc\": \"11111\"}\n",
      "<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "stus = {'xiaojun':'123456','xiaohei':'7891','abc':'11111'}\n",
    "res2 = json.dumps(stus)   #先把字典转成json\n",
    "print(res2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "chicken-hands",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n"
     ]
    }
   ],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
